You can now implement a movie data export component by calling new MovieExportFromProceduresToDataRef function.
Because many existing applications expect to be able to perform an export operation from a Movie or Track, export components should support MovieExportToFile , MovieExportFromProceduresToDataRef and MovieExportToDataRef . Using the routines described in "Functions Provided by the Movie Export Component" , it is possible to provide small implementations of these old-style routines that simply call the newer MovieExportFromProceduresToDataRef to perform the actual operation.
Listing 12 shows how to implement MovieExportToFile so that it simply calls MovieExportToDataRef .
Listing 12 Calling MovieExportToDataRef from MovieExportToFile
pascal ComponentResult MovieExportToFile(Globals store,
const FSSpec *theFile, Movie m, Track onlyThisTrack,
TimeValue startTime, TimeValue duration)
{
ComponentResult err;
AliasHandle alias;
err = QTNewAlias (theFile, &alias, true);
if (err) goto bail;
err = MovieExportToDataRef(store->self, (Handle)alias,
rAliasType, m, onlyThisTrack, startTime, duration);
DisposeHandle((Handle)alias);
bail:
return err;
}
Listing 13 shows how to use the utility routines provided by the QuickTime movie data export component to implement MovieExportToDataRef by calling MovieExportFromProceduresToDataRef . Your implementation will differ depending on the types of data to be exported. For example, the number and type of data sources created will change. This example creates a single sound data source, and is appropriate for any movie data export component that exports audio only.
Listing 13 Calling MovieExportFromProceduresToDataRef from MovieExportToDataRef
pascal ComponentResult MovieExportToDataRef(Globals store,
Handle dataRef, OSType dataRefType, Movie m,
Track onlyThisTrack, TimeValue startTime,
TimeValue duration)
{
ComponentResult err;
ComponentDescription cd;
ComponentInstance ci;
TimeScale scale;
MovieExportGetPropertyUPP getPropertyProc = nil;
MovieExportGetDataUPP getDataProc = nil;
void *refCon;
long trackID;
cd.componentType = MovieExportType;
cd.componentSubType = 'MooV';
cd.componentManufacturer = 0;
cd.componentFlags = canMovieExportFromProcedures;
cd.componentFlagsMask = canMovieExportFromProcedures;
err = OpenAComponent(FindNextComponent(nil, &cd), &ci);
if (err) goto bail;
err = MovieExportNewGetDataAndPropertiesProcs(ci,
SoundMediaType, &scale, m, onlyThisTrack,
startTime, duration,
&getPropertyProc, &getDataProc, &refCon);
if (err) goto bail;
err = MovieExportAddDataSource(store->self, SoundMediaType,
scale, &trackID, getPropertyProc, getDataProc,
refCon);
if (err) goto bail;
err = MovieExportFromProceduresToDataRef(store->self,
dataRef, dataRefType);
if (err) goto bail;
bail:
if (getPropertyProc) {
MovieExportDisposeGetDataAndPropertiesProcs(ci,
getPropertyProc, getDataProc, refCon);
}
if (ci)
CloseComponent(ci);
return err;
}
| Previous | Chapter contents | Chapter top | Section top | Next |